<?php
    $dbhost = 'localhost';
	$dbuser = 'root';
	$dbpass = '';
	$item_per_page =5;
	$conn = mysql_connect($dbhost, $dbuser, $dbpass);
	mysql_select_db('family_safety'); 
	
   $page_number = filter_var($_POST["page"], FILTER_SANITIZE_NUMBER_INT, FILTER_FLAG_STRIP_HIGH);
   if(!is_numeric($page_number)){
	header('HTTP/1.1 500 Invalid page number!');
	exit();
   }
	$position = ($page_number * $item_per_page);
    $result="";
	$results = 'SELECT * FROM user_reviews ORDER BY sno ASC LIMIT '.$position.', '.$item_per_page.'';
	$retval= mysql_query($results, $conn );
	?>
	<div class="span2">
	<?
    while($row = mysql_fetch_array($retval))
	{
	?>
            <div class="marbt">
					<div class="author_left">
						<a href='<?echo $row["google_link"];?>' target="_blank"><img class="author_br" alt='<?echo $row["user_name"];?>' src='<?echo $row["image"];?>'></a>
					</div>
					<div class="author_comment">
						<p>
							<?
								$rating=(int)(str_replace('.0','',$row["rating"]));
								for($i=1;$i<=$rating;$i++){
							?>											
						   <img src="img/green-star.png">
							<?}for($j=$i;$j<=5;$j++){?>
						   <img src="img/gray-star.png">
							<?}?>
						</p>
						<span><?echo $row["user_name"];?>'</span>
						 <p><?echo $row["review"];?></p>
		            </div>
		                
			</div>
		</div>
	<?}
?>

